#include <iostream>
#include <unistd.h>
#include <signal.h>
using namespace std;

void handler(int signo)
{
    cout << "handler " << signo << endl;
} 

int main()
{
    cout << "getpid: " << getpid() << endl;
    signal(2, handler);
    sigset_t block, oblock;
    sigemptyset(&block);
    sigemptyset(&oblock);
    for(int signo = 1; signo <= 31; signo++)
    {
        sigaddset(&block, signo);
    }
    sigprocmask(SIG_SETMASK, &block, &block);
    while(true)
    {
        cout << "我已经屏蔽了所有的信号，来打我呀!" << endl;
        sleep(1);
    }
    return 0;
}